/**
 * Created by CK on 2016/12/18.
 */
$(document).ready(function(){
    var resPackId = xhTool.getQuery('iRPId');
    var userType;
    var commit;
    $(':checkbox').bootstrapSwitch({
        onColor: 'success',
        offColor: 'warning',
        size: 'small',
        onSwitchChange: function(event, state){
            userType = $(this).val();
            commit = state ? 'in' : 'out';
            $.post(baseUrl + 'Res/setResPackPower', {iRPId: resPackId, target: 'userType', values: userType, type: commit}, function (result) {
                $.toast({
                    heading: '结果',
                    text: result,
                    showHideTransition: 'slide',
                    position: 'bottom-center',
                    icon: 'info',
                    stack: 3
                })
            });
        }
    });
});